package org.bastion.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.bastion.domain.Alert;
import org.bastion.service.AlertService;

public class BasicAlertService implements AlertService {

    List<Alert> alerts = new ArrayList<Alert>();

    public void addAlert(Alert alert) {
        alerts.add(alert);
    }

    public List<Alert> getAlerts(boolean clearAlertsAfterwards) {
        if (clearAlertsAfterwards) {
            List<Alert> copy = new ArrayList<Alert>(alerts);
            alerts.clear();
            return copy;
        }
        return alerts;
    }

}
